Passed
Push — master ( 943b8e...9278a4 )
by Mathieu
01:38
created

QuoteItem   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 39
dl 0
loc 44
c 0
b 0
f 0
rs 10

3 Functions

Rating   Name   Duplication   Size   Complexity  
A getTitle 0 3 1
A getQuantity 0 3 1
A getDailyRate 0 3 1
1
import {Entity, Column, PrimaryGeneratedColumn, ManyToOne} from 'typeorm';
2
import {Quote} from './Quote.entity';
3
4
@Entity()
5
export class QuoteItem {
6
  @PrimaryGeneratedColumn('uuid')
7
  private id: string;
8
9
  @Column({type: 'varchar', nullable: false})
10
  private title: string;
11
12
  @Column({type: 'integer', nullable: false})
13
  private quantity: number;
14
15
  @Column({type: 'integer', nullable: false})
16
  private dailyRate: number;
17
18
  @ManyToOne(
19
    type => Quote,
20
    quote => quote.items,
21
    {nullable: false}
22
  )
23
  quote: Quote;
24
25
  constructor(
26
    title: string,
27
    quantity: number,
28
    dailyRate: number,
29
    quote: Quote
30
  ) {
31
    this.title = title;
32
    this.quantity = quantity;
33
    this.dailyRate = dailyRate;
34
    this.quote = quote;
35
  }
36
37
  public getTitle(): string {
38
    return this.title;
39
  }
40
41
  public getDailyRate(): number {
42
    return this.dailyRate;
43
  }
44
45
  public getQuantity(): number {
46
    return this.quantity;
47
  }
48
}
49